package com.school.chapter02.tree_;

import com.school.chapter02.stack_.Stack;

public class Tree_ {
    public BinNode_ root;

    public Tree_(BinNode_ root) {
        this.root = root;
    }

    //中序遍历
    public void inOrder(BinNode_ node){
        Stack<Integer> stack = new Stack<>();
        BinNode_ p = node;
        while(p!=null||!stack.isEmpty()){
            if (p!=null){
                stack.push(p);
                p=p.lchild;
            }else{
                p=(BinNode_) stack.pop();
                visit(p.data);
                p = p.rchild;
            }
        }
    }
    public void visit(int data){
        System.out.println(data);
    }

//    public static void main(String[] args) {
//        new Tree_()
//    }
}
